package com.yw.fileupload.upload.util.file;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

/**
 * @Author: Create by hbw
 * @Date: 2021/4/27 11:23
 */
public class FileExtUtils {

    /**
     * 允许的文件类型
     */
   private static final List<String> list = Arrays.asList(".jpg",".png",".jepg");


    /**
     * 判断后缀名是否正确
     * @param fileName 文件名
     * @return
     */
   public static boolean check(String fileName){
       Iterator<String> type = list.iterator();
       while (type.hasNext()) {
           String ext = type.next();
           if (fileName.toLowerCase().endsWith(ext)) {
               return true;
           }
       }
       return false;
   }


}
